﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using YasharEl.Infrastructure.ApplicationModel.Modularity;
using YasharEl.Infrastructure.ApplicationModel.Bootstrap.Extensibility;
using YasharEl.Infrastructure.ApplicationModel.Bootstrap.Extensions;
using YasharEl.Infrastructure.ApplicationModel.Modularity.Bootstrap;
using YasharEl.Infrastructure.Diagnostics.Logging;
using YasharEl.Infrastructure.ApplicationModel.WebService.Modularity;

namespace YasharEl.Infrastructure.OrgUnit.ApplicationModel.Modularity
{
    public class OrganizationalUnitModule : BaseModule
    {
        #region BaseModule Overrides

        protected override IEnumerable<IComplexBootstrappingExtension> EnumerateModuleComponents()
        {
            return new List<IComplexBootstrappingExtension>(
                new IComplexBootstrappingExtension[] 
                {
                    new LoggingBootstrapperExtension(),
                    new ExceptionHandlingBootstrapperExtension(),
                    new EntitiesModelServicesConfigurationBootstrapperExtension(),
                    new ObjectFactoryBootstrapperExtension(),
                    new ResourcesManagementBootstrapperExtension(),
                    new CachingBootstrapperExtension(),
                    new ServiceModelBootstrapperExtension(),
                });
        }

        protected override BaseModuleBootstrapper<IModuleComponentBootstrappingExtension> CreateModuleBootstrapper()
        {
            return new UnityModuleBootstrapper(
                ModuleContainer,
                ModuleContainer.DependencyResolver.Resolve<ILogger<BaseModuleBootstrapper<IModuleComponentBootstrappingExtension>>>(),
                this
            );
        }

        #endregion
    }
}
